package com.company.action;

import com.company.service.PageProService;
import org.apache.struts2.ServletActionContext;

public class PagePro1Action extends BaseAction {

    PageProService pageProService;

    public PageProService getPageProService() {
        return pageProService;
    }

    public void setPageProService(PageProService pageProService) {
        this.pageProService = pageProService;
    }

    @Override
    public String execute() throws Exception {
        // TODO Auto-generated method stub int
        int pageNum = Integer.valueOf(ServletActionContext.getRequest()
                .getParameter("page"));
        int PageMaxnum = pageProService.queryPageNum(1);
        if (pageNum > PageMaxnum) {
            return "success";
        }
        ServletActionContext.getRequest().getSession()
                .setAttribute("PageMaxnum", PageMaxnum);
        ServletActionContext.getRequest().getSession()
                .setAttribute("ProList", pageProService.query(pageNum, 1));
        return super.execute();
    }

}
